
  window.onload=function(){
    let user={
        account:'3838721560@qq.com',
        password:'ant.design'
    }
    document.querySelector('.btn').onclick=function(){
        
        let account=document.querySelector('.account').value;
        let password=document.querySelector('.password').value;
        if(account==''||password==''){
            alert('账号或密码不能为空!');
            return;
        }
        if(account!=user.account||password!=user.password){
            alert('账号或密码输入有误!');
            return;
        }
       
        // alert('登录成功!');
        // console.log(111)
        // document.querySelector('.account').value='';
        // document.querySelector('.password').value='';
        // window.location.href="http://127.0.0.1:5500/denglu/yemian.html";
        var json={email:account,password:password};
        var jsonStr=JSON.stringify(json);
        console.log(jsonStr);
        $.ajax({
            url:"http://47.112.110.215:8989/auth/login",
            type:"post",
            contentType: "application/json",
            data:jsonStr,
            success: function(result) {
                console.log(result);
                window.localStorage.setItem("token",result.data.token);
               
                location.href="yemian.html";
               },
            error: function(xhr, status, error) {
                console.log(error);
              },
            
        })
       
    }
  }
        
   
